﻿<%@ Page Title="Companies Manager" Language="C#" MasterPageFile="~/administration/Admin.master"
    AutoEventWireup="true" CodeFile="ManageCompanies.aspx.cs" Inherits="administration_ManageCompanies" %>

<%@ MasterType VirtualPath="~/administration/Admin.master" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <div class="element">
        <label for="name">
            Company Name
        </label>
        <input id="txtCompanySearchName" runat="server" clientidmode="Static" name="name"
            class="text err" />
        <asp:Button ID="btnSearch" CssClass="button" Text="Find" runat="server" OnClick="btnSearch_Click" />
    </div>
    <asp:Label ID="lblCompNotFound" Text="Company not found" runat="server" ForeColor="Red"
        Visible="false" />
    <asp:GridView ID="gvCompanies" runat="server" AutoGenerateColumns="false" Visible="false"
        DataKeyNames="CompanyID" OnRowDeleting="gvCompanies_RowDeleting">
        <Columns>
            <asp:BoundField DataField="CompanyID" HeaderText="ID" ControlStyle-Width="20px" />
            <asp:TemplateField HeaderText="Logo" ControlStyle-Width="51px">
                <ItemTemplate>
                    <asp:Image ImageUrl='<%# GetImageDir()+Eval("Logo") %>' runat="server" Width="50px"
                        Height="50px" />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Logo" ControlStyle-Width="51px">
                <ItemTemplate>
                    <a target="_blank" href='http://revio.ge/singlecompany.aspx?id=<%# Eval("CompanyID")%>'>
                        <%# Eval("Name")%>
                    </a>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="Name" HeaderText="Name" ControlStyle-Width="150px" />
            <asp:BoundField DataField="Rating" HeaderText="Rating" ControlStyle-Width="20px" />
            <asp:TemplateField HeaderText="Website" ControlStyle-Width="60px">
                <ItemTemplate>
                    <asp:HyperLink runat="server" Target="_blank" NavigateUrl='<%# (Eval("Website") ?? "").ToString().StartsWith("http") ? Eval("Website") : "http"+Eval("Website") %>'
                        Text='<%# (Eval("Website") ?? "").ToString().Length < 15 ? (Eval("Website") ?? "").ToString():(Eval("Website") ?? "").ToString().Substring(0,15)%>'></asp:HyperLink>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="ReviewsCount" HeaderText="Rws" ControlStyle-Width="20px" />
            <asp:CommandField ShowDeleteButton="true" CancelText="Cancel" DeleteText="Delete"
                ButtonType="Image" DeleteImageUrl="~/administration/img/ad-delete.png"  />
        </Columns>
    </asp:GridView>
</asp:Content>
